package bat.iog.test;

public class Bowen {


    public static void main(String[] args) {

        int lenContet = 16;
        byte[] contentByte = toLH(lenContet);
        String contentLen = Bytes2HexString(contentByte);
        
        
        System.out.println(contentLen);
        
    }

    public static String Bytes2HexString(byte[] b) {
        String result = "";
        for (int i=0; i < b.length; i++) {
            result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 );
        }
        return result;
    }

    public static byte[] toLH(int n) {
        byte[] b = new byte[4];
        b[0] = (byte) (n & 0xff);
        b[1] = (byte) (n >> 8 & 0xff);
        b[2] = (byte) (n >> 16 & 0xff);
        b[3] = (byte) (n >> 24 & 0xff);
        return b;
    }
    
}
